import type { AxiosResponse } from 'axios'
import request from '@/utils/request'

// 重点项目服务层
const PROJECT_URL = import.meta.env.VITE_APP_SREVICE_NAME_PROJECT_MONITOR // 'important-project-monitor'
// const PROJECT_URL = ''

/**
 * 重点项目接口
 */
class ProjectServe {
  /**
   * 获取关注项目清单
   */

  getUserFocusProjectList<T = any>(data: {
    cityCondition: string
    productId?: string
    projectCondition?: string
    projectName?: string
    propertyCondition?: string
    provinceCondition?: string
    userId?: string
  }): Promise<AxiosResponse<T>> {
    return request({
      url: `${PROJECT_URL}/miniProjectHome/getUserFocusProjectList`,
      method: 'post',
      data
    })
  }
  // 获取其他项目清单
  getProjectListByCondition<T = any>(data: {
    cityCondition: string
    productId?: string
    projectCondition?: string
    projectName?: string
    propertyCondition?: string
    provinceCondition?: string
    userId?: string
  }): Promise<AxiosResponse<T>> {
    return request({
      url: `${PROJECT_URL}/miniProjectHome/getProjectListByCondition`,
      method: 'post',
      data
    })
  }
  // 关注
  focus<T = any>(data: {
    cityCondition: string
    productId?: string
    projectCondition?: string
    projectName?: string
    propertyCondition?: string
    provinceCondition?: string
    userId?: string
  }): Promise<AxiosResponse<T>> {
    return request({
      url: `${PROJECT_URL}/miniProjectHome/focus`,
      method: 'post',
      data
    })
  }
  // 取消关注
  cancelFocus<T = any>(data: {
    cityCondition: string
    productId?: string
    projectCondition?: string
    projectName?: string
    propertyCondition?: string
    provinceCondition?: string
    userId?: string
  }): Promise<AxiosResponse<T>> {
    return request({
      url: `${PROJECT_URL}/miniProjectHome/cancelFocus`,
      method: 'post',
      data
    })
  }
  // 查询筛选条件组合
  getSelectConditionList<T = any>(data = {}): Promise<AxiosResponse<T>> {
    return request({
      url: `${PROJECT_URL}/miniProjectHome/getSelectConditionList`,
      method: 'post',
      data
    })
  }
}

export default new ProjectServe()
